<template>
  <!-- 会员列表 -->
  <div class="pagss">

    <div style="height: 20px;"></div>
    <Navvz></Navvz>

    <div style="padding: 50px 20px 50px 20px;">

      <div class="row_a_c pu_20 space-between" style="margin-top: -40px;">
        <div class="row_a_c">
          <img class="tu1" src="@/assets/images/sjyl.png" />
          <div class="ml_10 f_22 f_bold">数据管理</div>
        </div>
      </div>

      <div class="mb_10 p_30" style="background: #fff;border-radius: 10px;">
        <el-row type="flex" :gutter="20">
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="datum__list">数据一览</el-checkbox></el-col>
        </el-row>
      </div>

      <div class="row_a_c pu_20 space-between">
        <div class="row_a_c">
          <img class="tu1" src="@/assets/images/message.png" />
          <div class="ml_10 f_22 f_bold">公告管理</div>
        </div>
      </div>

      <div class="mb_10 p_30" style="background: #fff;border-radius: 10px;">
        <el-row type="flex" :gutter="20">
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="notice__list">公告列表</el-checkbox></el-col>
        </el-row>
      </div>

      <div class="row_a_c pu_20 space-between">
        <div class="row_a_c">
          <img class="tu1" src="@/assets/images/rizi.png" />
          <div class="ml_10 f_22 f_bold">日志管理</div>
        </div>
      </div>

      <div class="mb_10 p_30" style="background: #fff;border-radius: 10px;">
        <el-row type="flex" :gutter="20">
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="log__update">更新日志</el-checkbox></el-col>

        </el-row>
      </div>


      <div class="row_a_c pu_20 space-between">
        <div class="row_a_c">
          <img class="tu1" src="@/assets/images/htgl.png" />
          <div class="ml_10 f_22 f_bold">游戏管理</div>
        </div>
      </div>

      <div class="mb_10 p_30" style="background: #fff;border-radius: 10px;">
        <el-row type="flex" :gutter="20">
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="game__databaseCon">申请测试</el-checkbox></el-col>
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="game__officialList">版本列表</el-checkbox></el-col>
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="game__playerRechargeRecord">充值记录</el-checkbox></el-col>


        </el-row>
      </div>


      <div class="row_a_c pu_20 space-between">
        <div class="row_a_c">
          <img class="tu1" src="@/assets/images/sj.png" />
          <div class="ml_10 f_22 f_bold">财务管理</div>
        </div>
      </div>

      <div class="mb_10 p_30" style="background: #fff;border-radius: 10px;">
        <el-row type="flex" :gutter="20">
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="finance__settlementInformation">财务记录</el-checkbox></el-col>
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="finance__contract">合同管理</el-checkbox></el-col>
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="finance__invoice">发票管理</el-checkbox></el-col>
        </el-row>
      </div>


      <div class="row_a_c pu_20 space-between">
        <div class="row_a_c">
          <img class="tu1" src="@/assets/images/jszc.png" />
          <div class="ml_10 f_22 f_bold">技术支持</div>
        </div>
      </div>

      <div class="mb_10 p_30" style="background: #fff;border-radius: 10px;">
        <el-row type="flex" :gutter="20">
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="technical__problem">常见问题</el-checkbox></el-col>
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="technical__menuPerm">使用手册</el-checkbox></el-col>
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="technical__videoCourse">视频教程</el-checkbox></el-col>
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="technical__workSub">工单管理</el-checkbox></el-col>
        </el-row>
      </div>


      <div class="row_a_c pu_20 space-between">
        <div class="row_a_c">
          <img class="tu1" src="@/assets/images/rlzy.png" />
          <div class="ml_10 f_22 f_bold">资源管理</div>
        </div>
      </div>

      <div class="mb_10 p_30" style="background: #fff;border-radius: 10px;">
        <el-row type="flex" :gutter="20">
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="manpower__resource">人力资源</el-checkbox></el-col>
        </el-row>
      </div>


      <div class="row_a_c pu_20 space-between">
        <div class="row_a_c">
          <img class="tu1" src="@/assets/images/sz.png" />
          <div class="ml_10 f_22 f_bold">账号设置</div>
        </div>
      </div>

      <div class="mb_10 p_30" style="background: #fff;border-radius: 10px;">
        <el-row type="flex" :gutter="20">
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="account__bypass">子账号管理</el-checkbox></el-col>
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="account__personalm">账号信息</el-checkbox></el-col>
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="account__certificate">实名认证</el-checkbox></el-col>
        </el-row>
      </div>

      <!--      <div class="row_a_c pu_20 space-between">
        <div class="row_a_c">
          <img class="tu1" src="@/assets/images/tc.png" />
          <div class="ml_10 f_22 f_bold">系统管理</div>
        </div>
      </div>

      <div class="mb_10 p_30" style="background: #fff;border-radius: 10px;">
        <el-row type="flex" :gutter="20">
          <el-col :xs="10" :sm="6" :md="5" :lg="4" :xl="3"><el-checkbox v-model="wallet__USDT">退出系统</el-checkbox></el-col>
        </el-row>
      </div> -->

      <div class="handle-box center">
        <el-button type="primary" class="handle-del mr10 mb_20 mt_10" style="width: 200px;height: 50px;" @click="editSubmit()">确 认 修 改</el-button>
        <el-button type="primary" class="handle-del mr10 mb_20 mt_10" style="width: 200px;height: 50px;" @click="toUrl('/center/bypassAccount')">返 回</el-button>
      </div>




    </div>

  </div>
</template>

<script>
  import Navvz from "@/components/Navvz";
  import * as UserPermission from "@/api/system/user_permission";
  export default {
    components: {
      Navvz,
    },
    data() {
      return {
        loading: false,
        id: '',
        user_id: '', //用户ID
        pid: '',

        datum: false, //数据管理
        datum__list: false, //数据一览

        notice: false, //公告管理
        notice__list: false, //公告列表

        log: false, //日志管理
        log__update: false, //更新日志

        game: false, //游戏管理
        game__databaseCon: false, //申请测试
        game__officialList: false, //版本列表
        game__playerRechargeRecord: false, //充值记录

        finance: false, //财务管理
        finance__settlementInformation: false, //财务记录
        finance__contract: false, //合同管理
        finance__invoice: false, //发票管理

        technical: false, //技术支持
        technical__problem: false, //常见问题
        technical__menuPerm: false, //使用手册
        technical__workSub: false, //工单管理
        technical__videoCourse: false, //视频教程

        manpower: false, //资源管理
        manpower__resource: false, //人力资源

        account: false, //账号设置
        account__bypass: false, //子账号管理
        account__personalm: false, //账号信息
        account__certificate: false, //实名认证

        system: true,
        system__out: true,
      };
    },
    created() {
      this.user_id = this.$route.query.user_id;
      this.pid = this.$route.query.pid;
      this.getinfo();
    },

    methods: {
      //查询用户权限详情
      getinfo() {
        var p = {
          user_id: this.user_id,
          product: 'biqi-developer-platform',
        };

        UserPermission.info(p).then(response => {
          var menu_permission = response.data.menu_permission;

          this.datum = menu_permission[0].datum;
          this.datum__list = menu_permission[1].datum__list;

          this.notice = menu_permission[2].notice;
          this.notice__list = menu_permission[3].notice__list;

          this.log = menu_permission[4].log;
          this.log__update = menu_permission[5].log__update;

          this.game = menu_permission[6].game;
          this.game__databaseCon = menu_permission[7].game__databaseCon;
          this.game__officialList = menu_permission[8].game__officialList;
          this.game__playerRechargeRecord = menu_permission[9].game__playerRechargeRecord;

          this.finance = menu_permission[10].finance;
          this.finance__settlementInformation = menu_permission[11].finance__settlementInformation;
          this.finance__contract = menu_permission[12].finance__contract;
          this.finance__invoice = menu_permission[13].finance__invoice;

          this.technical = menu_permission[14].technical;
          this.technical__problem = menu_permission[15].technical__problem;
          this.technical__menuPerm = menu_permission[16].technical__menuPerm;
          this.technical__workSub = menu_permission[17].technical__workSub;
          this.technical__videoCourse = menu_permission[18].technical__videoCourse;


          this.manpower = menu_permission[19].manpower;
          this.manpower__resource = menu_permission[20].manpower__resource;

          this.account = menu_permission[21].account;
          this.account__bypass = menu_permission[22].account__bypass;
          this.account__personalm = menu_permission[23].account__personalm;
          this.account__certificate = menu_permission[24].account__certificate;


          // this.system = menu_permission[24].system;
          // this.system__out = menu_permission[25].system__out;


          this.system = true;
          this.system__out = true;

          this.loading = false;
        });

      },
      //编辑提交
      editSubmit() {
        if (this.datum__list) {
          this.datum = true
        } else {
          this.datum = false
        }

        if (this.notice__list) {
          this.notice = true
        } else {
          this.notice = false
        }

        if (this.log__update) {
          this.log = true
        } else {
          this.log = false
        }

        if (this.game__databaseCon || this.game__officialList || this.game__playerRechargeRecord) {
          this.game = true
        } else {
          this.game = false
        }

        if (this.finance__settlementInformation || this.finance__contract || this.finance__invoice) {
          this.finance = true
        } else {
          this.finance = false
        }

        if (this.technical__problem || this.technical__menuPerm || this.technical__videoCourse || this.technical__workSub) {
          this.technical = true
        } else {
          this.technical = false
        }

        if (this.manpower__resource) {
          this.manpower = true
        } else {
          this.manpower = false
        }

        if (this.account__bypass || this.account__personalm || this.account__certificate) {
          this.account = true
        } else {
          this.account = false
        }

        if (this.system__out) {
          this.system = true
        } else {
          this.system = false
        }

        var menu_permission = [
          { datum: this.datum },
          { datum__list: this.datum__list },

          { notice: this.notice },
          { notice__list: this.notice__list },

          { log: this.log },
          { log__update: this.log__update },

          { game: this.game },
          { game__databaseCon: this.game__databaseCon },
          { game__officialList: this.game__officialList },
          { game__playerRechargeRecord: this.game__playerRechargeRecord },

          { finance: this.finance },
          { finance__settlementInformation: this.finance__settlementInformation },
          { finance__contract: this.finance__contract },
          { finance__invoice: this.finance__invoice },

          { technical: this.technical },
          { technical__problem: this.technical__problem },
          { technical__menuPerm: this.technical__menuPerm },
          { technical__workSub: this.technical__workSub },
          { technical__videoCourse: this.technical__videoCourse },


          { manpower: this.manpower },
          { manpower__resource: this.manpower__resource },

          { account: this.account },
          { account__bypass: this.account__bypass },
          { account__personalm: this.account__personalm },
          { account__certificate: this.account__certificate },

          { system: this.system },
          { system__out: this.system__out },
        ];

        var p = {
          user_id: this.user_id,
          pid: this.pid,
          product: 'biqi-developer-platform',
          menu_permission: menu_permission,
        };

        console.log('p', p)
        this.loading = true;
        UserPermission.update(p).then(response => {
          this.$modal.msgSuccess('修改成功');
          this.loading = false;
          this.toUrl('/center/bypassAccount')
        });

      },

      toUrl(url) {
        this.$router.push({
          path: url,
        })
      },

    }
  };
</script>

<style lang="scss" scoped>
  .pagss {
    height: 100%;
    background: #E4EEF9;
  }

  .tu1 {
    width: 21px;
    height: 17px;
  }


  ::v-deep .el-checkbox__label {
    font-size: 22px;
  }

  ::v-deep .el-checkbox__input.is-checked .el-checkbox__inner {
    zoom: 150%;
    border-radius: 50% !important;
  }

  ::v-deep .el-checkbox__inner {
    zoom: 150%;
    border-radius: 50% !important;
  }

  ::v-deep .el-checkbox__input.is-checked .el-checkbox__inner::after {
    margin-left: 0.5px;
  }
</style>
